<ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:rich="http://richfaces.org/rich"
  xmlns:a4j="http://richfaces.org/a4j"
  xmlns:s="http://jboss.org/schema/seam/taglib"
  template="../WEB-INF/template/template_2x.xhtml">

  <ui:define name="page_title">#{msgs['jsf.InactiveAccount']}</ui:define>

  <ui:define name="head">
    <script type="text/javascript">
      function showUpdateEmailLoading(show) {
        if (show == true) {
          document.getElementById("#{rich:clientId('updateEmailLoading')}").style.display =
            'inline';
        }
        else {
          document.getElementById("#{rich:clientId('updateEmailLoading')}").style.display =
            'none';
        }
      }

      function showSendEmailLoading(show) {
        if (show == true) {
          document.getElementById("#{rich:clientId('sendActivationEmail')}").style.display =
            'inline';
        }
        else {
          document.getElementById("#{rich:clientId('sendActivationEmail')}").style.display =
            'none';
        }
      }
    </script>
  </ui:define>

  <ui:define name="center_content">
    <h:form styleClass="inactiveAccountForm">
      <h:outputText value="#{msgs['jsf.inactiveaccount.PleaseSelectOne']}"
        styleClass="inactive_message"/>

      <s:div styleClass="contentDiv">
        <h:commandButton id="resendEmail"
          value="#{msgs['jsf.ResendActivationEmail']}"
          action="#{inactiveAccountAction.sendActivationEmail}"
          onclick="showSendEmailLoading(true)"/>
        <h:graphicImage value="/images/loading.gif" id="sendActivationEmail"
          style="display:none"/>
      </s:div>

      <h:outputText value="#{msgs['jsf.or']}"
        styleClass="inactive_message_bold"/>

      <s:div styleClass="contentDiv">
        <h:outputText value="#{msgs['jsf.inactiveaccount.UpdateAndResend']}"
          styleClass="inactive_message"/>

        <s:decorate id="emailField" template="../WEB-INF/layout/edit.xhtml"
          enclose="true">
          <ui:define name="label">#{msgs['jsf.Email']}</ui:define>
          <h:inputText id="email" value="#{inactiveAccountAction.email}">
            <a4j:ajax event="blur" render="emailField"/>
          </h:inputText>
          <s:span styleClass="icon-info-circle-2 input_help" id="emailHelp">
            <rich:tooltip>
              #{msgs['jsf.EmailToolTip']}
            </rich:tooltip>
          </s:span>
        </s:decorate>

        <div style="clear:both;"/>

        <h:commandButton id="updateEmail" value="#{msgs['jsf.UpdateEmail']}"
          action="#{inactiveAccountAction.changeEmail}"
          onclick="showUpdateEmailLoading(true)"/>
        <h:graphicImage value="/images/loading.gif" id="updateEmailLoading"
          style="display:none"/>
      </s:div>
    </h:form>

  </ui:define>

</ui:composition>
